// import { post, get } from "@/http/request";
import service from "@/http/request";
// 登录所需的参数
export type LoginRequest = {
    username: string;
    password: string;
};
// 刷新登录信息需要的参数
export type reLoginRequest = {
    accessToken: string;
};
// 登录后返回的响应信息
export type LoginResponse = {
    username: string;
    roles: Array<string>;
    accessToken: string;
};
// post 请求直接传入一个 data 即可 url 我们直接在此处封装好
// 需要更改时也只需在此处更改
// export const userLogin = async (data?: LoginRequest) => {
//     return post<LoginResponse>({}, "/login", data);
// };
// export const refreshUserInfo = async (data?: reLoginRequest) => {
//     return post<LoginResponse>({}, "/getUserInfo", data);
// };

// export const getGoodsList = async (data) => {
//     return get({}, "/goods", data);
// };

// 登录接口
export function userLogin(data: LoginRequest) {
    return service({
        url: "/login",
        method: "POST",
        data,
    });
}
// 登录接口
export function refreshUserInfo(data: reLoginRequest) {
    return service({
        url: "/getUserInfo",
        method: "POST",
        data,
    });
}

export function getGoodsList(data: reLoginRequest) {
    return service({
        url: "/goods",
        method: "GET",
        data,
    });
}
